import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

export default new Router({
  routes: [{
      // 登录页
      path: '/',
      // redirect: to => {
      //   console.log(to.query);
      //   return to.query.url
      // }
    }, {
      // 登录页
      name: 'Login',
      path: '/login',
      component: resolve => require(['../components/pages/login'], resolve)
    }, {
      // 用户画像页
      name: 'UserInfo',
      path: '/user-info',
      component: resolve => require(['../components/pages/user-info'], resolve)
    }, {
      // 注册页
      name: 'Register',
      path: '/register',
      component: resolve => require(['../components/pages/register'], resolve)
    }, {
      // 忘记密码页面
      name: 'ForgetPassword',
      path: '/forget-password',
      component: resolve => require(['../components/pages/forget-password'], resolve)
    }, {
      // 公共： 首页
      path: '/index',
      component: resolve => require(['../components/common/index'], resolve),
      children: [{
          // 首页
          name: 'Home',
          path: '/',
          component: resolve => require(['../components/pages/home'], resolve)
        }, {
          // 发布页
          name: 'Publish',
          path: '/publish',
          component: resolve => require(['../components/pages/publish'], resolve)
        }, {
          // 发布页
          name: 'Order',
          path: '/order',
          component: resolve => require(['../components/pages/order'], resolve)
        }, {
          // 发布页
          name: 'Mine',
          path: '/mine',
          component: resolve => require(['../components/pages/mine'], resolve)
        }
      ]
    }, {
      // 搜索页
      name: 'Search',
      path: '/search',
      component: resolve => require(['../components/pages/search'], resolve)
    }, {
      // 详情页
      path: '/detail',
      component: resolve => require(['../components/pages/detail'], resolve),
      children: [{
          // 详情页下面
          name: 'DetailBottom',
          path: '/',
          component: resolve => require(['../components/pages/detail-bottom'], resolve)
      }]
    }, {
      // 地图
      name: 'Map',
      path: '/map',
      component: resolve => require(['../components/pages/map'], resolve)
    }, {
      // 个人信息
      name: 'PersonalInfo',
      path: '/personal-info',
      component: resolve => require(['../components/pages/personal-info'], resolve)
    }, {
      // 我的钱包
      name: 'Wallet',
      path: '/wallet',
      component: resolve => require(['../components/pages/wallet'], resolve)
    }, {
      // 收支明细
      name: 'Income',
      path: '/income',
      component: resolve => require(['../components/pages/income'], resolve)
    }, {
      // 账户安全
      name: 'Security',
      path: '/security',
      component: resolve => require(['../components/pages/security'], resolve)
    }, {
      // 系统信息
      name: 'SystemInfo',
      path: '/system-info',
      component: resolve => require(['../components/pages/system-info'], resolve)
    },
  ]
})
